import { legacy_createStore, applyMiddleware } from 'redux';
import reducer from './reducers';
// 1.导入thunkMiddleware中间件
import thunkMiddleware from 'redux-thunk';

// 2.应用thunkMiddleware中间件
// 在创建store之前, 通过applyMiddleware方法, 告诉Redux需要应用哪些中间件
const storeEnhancer = applyMiddleware(thunkMiddleware);
// 利用store来保存状态（state）
const store = legacy_createStore(reducer, storeEnhancer);

export default store;